<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
//前台首页控制器
class IndexController extends Controller{
//	 载入前台页面
	public function index(){
//		sp($_SESSION);die;
	//	获得分类数组
	//		载入分类
		$category=new \Common\Model\Category;
		//获得所有分类
		$catedata=$category->where('pid',0)->get();
		
		foreach($catedata as $k=>$v){
			$catedata[$k]['son']=$category->where('pid',$v['cid'])->get();
			foreach($catedata[$k]['son'] as $sk=>$sv){
			$catedata[$k]['son'][$sk]['nextson']=$category->where('pid',$sv['cid'])->get();
			}
		}
		
//		sp($catedata);die;
	//分配
		View::with('catedata',$catedata);
		View::make();
	}
}
